/*
 * SonarQube
 * Copyright (C) 2009-2017 SonarSource SA
 * mailto:info AT sonarsource DOT com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
@import (reference) "../mixins";
@import (reference) "../variables";
@import (reference) "ui";

@background: #475760;

.tooltip,
.rc-tooltip {
  position: absolute;
  z-index: @tooltip-z-index;
  display: block;
  height: auto;
  font-size: @smallFontSize;
  font-weight: 300;
  line-height: 1.5;
  animation: fadeIn 0.3s forwards;
}

.rc-tooltip-hidden {
  display: none;
}

.tooltip.in {

}

.tooltip.top,
.rc-tooltip-placement-top {
  padding: 5px 0;
  margin-top: -3px;
}

.tooltip.right,
.rc-tooltip-placement-right {
  padding: 0 5px;
  margin-left: 3px;
}

.tooltip.bottom,
.rc-tooltip-placement-bottom {
  padding: 5px 0;
  margin-top: 3px;
}

.tooltip.left,
.rc-tooltip-placement-left {
  padding: 0 5px;
  margin-left: -3px;
}

.tooltip-inner,
.rc-tooltip-inner {
  max-width: 300px;
  padding: 3px 8px;
  color: #fff;
  text-align: center;
  text-decoration: none;
  background-color: @background;
  border-radius: 4px;
  letter-spacing: 0.04em;
  overflow: hidden;
  word-break: break-word;

  .alert {
    margin-bottom: 5px /* align with side padding */ ;
    border-radius: 4px;
  }
}

.tooltip-arrow,
.rc-tooltip-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border: solid transparent;
}

.tooltip.top .tooltip-arrow,
.rc-tooltip-placement-top .rc-tooltip-arrow {
  bottom: 0;
  left: 50%;
  margin-left: -5px;
  border-width: 5px 5px 0;
  border-top-color: @background;
}

.tooltip.top-left .tooltip-arrow,
.rc-tooltip-placement-topLeft .rc-tooltip-arrow {
  right: 5px;
  bottom: 0;
  margin-bottom: -5px;
  border-width: 5px 5px 0;
  border-top-color: @background;
}

.tooltip.top-right .tooltip-arrow,
.rc-tooltip-placement-topRight .rc-tooltip-arrow {
  bottom: 0;
  left: 5px;
  margin-bottom: -5px;
  border-width: 5px 5px 0;
  border-top-color: @background;
}

.tooltip.right .tooltip-arrow,
.rc-tooltip-placement-right .rc-tooltip-arrow {
  top: 50%;
  left: 0;
  margin-top: -5px;
  border-width: 5px 5px 5px 0;
  border-right-color: @background;
}

.tooltip.left .tooltip-arrow,
.rc-tooltip-placement-left .rc-tooltip-arrow {
  top: 50%;
  right: 0;
  margin-top: -5px;
  border-width: 5px 0 5px 5px;
  border-left-color: @background;
}

.tooltip.bottom .tooltip-arrow,
.rc-tooltip-placement-bottom .rc-tooltip-arrow {
  top: 0;
  left: 50%;
  margin-left: -5px;
  border-width: 0 5px 5px;
  border-bottom-color: @background;
}

.tooltip.bottom-left .tooltip-arrow,
.rc-tooltip-placement-bottomLeft .rc-tooltip-arrow {
  top: 0;
  right: 5px;
  margin-top: -5px;
  border-width: 0 5px 5px;
  border-bottom-color: @background;
}

.tooltip.bottom-right .tooltip-arrow,
.rc-tooltip-placement-bottomRight .rc-tooltip-arrow {
  top: 0;
  left: 5px;
  margin-top: -5px;
  border-width: 0 5px 5px;
  border-bottom-color: @background;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}